package KK.Camera
{
	import flash.geom.Point;

	public class DragCamera extends Camera
	{
		private var dragPoint:Point;
		public function DragCamera(width:int, height:int)
		{
			//TODO: implement function
			super(width, height);
			init();
		}
		
		private function init():void{
			dragPoint=new Point();
		}
		
		/**
		 * 拖动位置  
		 * @param x
		 * @param y
		 * 
		 */
		public function BeginDrag(x:int,y:int):void{
			dragPoint.x=x;
			dragPoint.y=y;
		}
		
		/**
		 * 结束拖动  
		 * @param x
		 * @param y
		 * 
		 */
		public function EndDrag(x:int,y:int):void{
			var _x:int=ViewRect.x+dragPoint.x-x;
			var _y:int=ViewRect.y+dragPoint.y-y;
			_x=_x<0?0:_x;
			_y=_y<0?0:_y;
			CameraSite(_x,_y);
		}
	}
}